package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.ParkDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.park.vo.*;

/**
 * 园区管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ParkMapper extends BaseMapperX<ParkDO> {

    default PageResult<ParkDO> selectPage(ParkPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ParkDO>()
                .eqIfPresent(ParkDO::getParkCode, reqVO.getParkCode())
                .likeIfPresent(ParkDO::getParkName, reqVO.getParkName())
                .eqIfPresent(ParkDO::getProvince, reqVO.getProvince())
                .eqIfPresent(ParkDO::getCity, reqVO.getCity())
                .eqIfPresent(ParkDO::getRegion, reqVO.getRegion())
                .eqIfPresent(ParkDO::getAddress, reqVO.getAddress())
                .eqIfPresent(ParkDO::getCompanyCode, reqVO.getCompanyCode())
                .eqIfPresent(ParkDO::getParkArea, reqVO.getParkArea())
                .eqIfPresent(ParkDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ParkDO::getDisabled, reqVO.getDisabled())
                .eqIfPresent(ParkDO::getParkWarehouseNum, reqVO.getParkWarehouseNum())
                .eqIfPresent(ParkDO::getParkWarehouseArea, reqVO.getParkWarehouseArea())
                .eqIfPresent(ParkDO::getLinkMan, reqVO.getLinkMan())
                .eqIfPresent(ParkDO::getLinkPhone, reqVO.getLinkPhone())
                .eqIfPresent(ParkDO::getLinkEmail, reqVO.getLinkEmail())
                .eqIfPresent(ParkDO::getPlatformCode, reqVO.getPlatformCode())
                .eqIfPresent(ParkDO::getLongitude, reqVO.getLongitude())
                .eqIfPresent(ParkDO::getLatitude, reqVO.getLatitude())
                .betweenIfPresent(ParkDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ParkDO::getId));
    }

}